<?php
/*
	首页
*/

defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$member=$this->model('member')->get_member();
	$member['credit1passtime']=date('Y年m月d日',time()+7*24*3600);
	$_SESSION['sex']=$member['sex'];
	$return['member']=$member;
	$return['params']=array('type'=>4);
	$return['pcd']=$this->session('pcd')?:array('city'=>'');
	$return['list']=array();
	$sharelink='jy_ailiao/quan//type='.$_RQ['type'].'&fromuser='.$_SESSION['uid'];
	$return['sharedata']=array(
			'title'=>$return['pluginset']['share_title']?:'我的私密视频',
			'desc'=>$return['pluginset']['share_desc']?:'我的私密视频，成就天下姻缘！',
			'link'=>custom_url($sharelink,true),
			'imgUrl'=>tomedia($return['pluginset']['share_image'])
	);
	set_html('title','我的私密视频');
	exi($return);
}
if($_RQ['op']=='getquanlog'){
	$type=$_RQ['type'];
	//获取最近50家店
	if(intval($_RQ['lat'])){
		$lat_lng=array('lat'=>$_RQ['lat'],'lng'=>$_RQ['lng']);
		$this->session('lat_lng',$lat_lng);
	}
	$lat_lng=$this->session('lat_lng');
	$params=array(
		'mid'=>$_SESSION['uid'],
		'uniacid'=>$_SESSION['uniacid'],
		'status'=>1,
		'noshow'=>0,
		'simi'=>1,
	);
	$orderby='createtime desc';
	$pindex = max(1, intval($_RQ['page']));
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,10000),//获取所有
		'fields'=>'',
		'key'=>'id',
		'orderby'=>$orderby,
		'orderbykey'=>$orderbykey,
	);
	$logs=$this->model('member')->getlogs($parameter,$_RQ['limit'],$lat_lng,intval($_RQ['page']),intval($_RQ['juli']));
	foreach($logs as $k=>&$v){
		$v['logo']=$v['logo']?tomedia($v['logo']):'';
		$v['topimg']=$v['topimg']?tomedia($v['topimg']):'';
		$v['createtime']=date('Y-m-d',$v['createtime']);
		$v['images']=json_decode($v['images'],true);
		foreach($v['images'] as &$iv){
			$iv=tomedia($iv);
		}
	}
	$return['list']=array_values($logs);
	exi($return);
}
if($_RQ['op']=='del'){
	$id=intval($_RQ['id']);
	if($id){
		$this->delete('newslog',array('id'=>$id));	
	}
	exi('删除成功！');
}
?>